<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta name="author" content="lzy">
    <title>lzy-</title>
    <script src="jquery-3.1.1.js"></script>
    <style>
        html,body{
            height: 100%;
        }
        body{
            margin: 0;
        }
        span{
            display: inline-block;
            width: 100px;
            height: 40px;
            line-height: 40px;
            text-align: center;
            background-color: greenyellow;
            position: absolute;
            left: 300px;
            top: 50px;
        }
        div{
            display: inline-block;
            width: 200px;
            position: absolute;
            left: 400px;
            top: 50px;
            text-align: center;
        }
        div p{
            margin: 0;
            padding: 0;
            background-color: lightgray;
            height: 40px;
            line-height: 40px;
            cursor: pointer;
        }
         ul,li{
            margin: 0;
            padding: 0;
            list-style-type: none;
            cursor: pointer;
        }
        ul{
            border: 1px solid red;
            display: none;
        }
        li{
            border-bottom: 1px dashed red;
            height: 40px;
            line-height: 40px;
        }
    </style>
</head>
<body>
    <span>选择项目：</span> 
    <div>
        <p>未选择</p>
        <ul>
            <li>html5</li>
            <li>css3</li>
            <li>javaScript</li>
            <li>jQuery</li>
        </ul>
    </div>
</body>
</html>
<script>
    $('p').click(function(){
        $('ul').show();
    })
    $('li').hover(function(){
        $(this).css('background-color','lightgray');
    },function(){
        $(this).css('background-color','white');
    })

    $('li').click(function(){
        $('p').text($(this).text());
        $('ul').hide();
    })
</script>